package com.xuecheng.comment.agent.fallback;

import com.xuecheng.api.content.model.dto.CourseBaseDTO;
import com.xuecheng.api.content.model.dto.TeachplanMediaDTO;
import com.xuecheng.comment.agent.ContentApiAgent;
import com.xuecheng.common.domain.code.CommonErrorCode;
import com.xuecheng.common.domain.response.RestResponse;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * <p></p>
 *
 * @Description:
 */
@Slf4j
@Component
public class ContentApiAgentFallbackFactory {



    public ContentApiAgent create(Throwable throwable) {
        return new ContentApiAgent() {

            public RestResponse<CourseBaseDTO> getCourseBaseByTargetId(Long targetId) {
                log.error("Feign 接口调用熔断降级，错误信息：{}", throwable.getMessage());
                return RestResponse.validfail(CommonErrorCode.E_999982);
            }

            @Override
            public CourseBaseDTO getCourseBaseById(Long courseId) {
                log.error("Feign 接口调用熔断降级，错误信息：{}", throwable.getMessage());
                return null;
            }

        };
    }
}
